home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Garbo
/
Garbo.cdr
/
mac
/
hypercrd
/
hc2_x
/
tcprogud.sit
/
picture ƒ
/
picthelp
< prev
next >
Wrap
Text File
|
1991-02-25
|
7KB
|
163 lines
Help file for the "Picture" project.
Ralph Gonzalez, PO Box 54, Newark, DE 19711, USA.
INTRODUCTION:
Picture is a class library for displaying and animating three-
dimensional color wire-frame drawings, although it may also be used for
displaying two-dimensional drawings. It supports segmentation of
graphical entities, multiple viewpoints and multiple projection windows,
and animation with an independent frame of reference for each (nested)
segment. It was written with the object-oriented Think C 4.0 compiler
by Symantec Corp., using Macintosh computers. However, the code
includes conditional compilation directives to allow compilation on any
computer with a C++ compiler, provided a Screen class has been written
for this computer. Presently Screen classes for Macintosh and IBM PC
(EGA/VGA) computers exist, although I hope to produce one for the X
Window system soon so the code can be used on any workstation using X
Window. (Note: the PC-specific code was written with the Turbo C++
compiler, and requires the presence of the file egavga.bgi in the
working directory.)
DISTRIBUTION:
Picture may be distributed freely as long as this Help file is included.
It is intended for educational use, although you may adapt if for
commercial use if you find it useful. I would appreciate well-
documented copies of any Picture applications you come up with. Users
are also encouraged to add functionality to the existing Picture
library, or to write new Screen classes for other computers. Please
send any such additions to me, including documentation, so I can include
them for distribution.
DESCRIPTION:
Picture consists of the following major classes: Camera, Frame,
Projector, Screen, Segment, and Transformation. All of these are
descendants of a Generic_Class.
Three-dimensional figures are defined by creating new classes which are
descendants of the Segment class. An existing descendant of Segment is
Nested_Segment. Figures which are defined as descendants of
Nested_Segments can easily be composed of combinations of existing
figures. An existing descendant of Nested_Segment is Animated_Segment.
Figures which derive from this class can define animate() methods which
indicate how the nested segments are to be animated.
Segments can be moved and animated using Transformations, including
scaling, translation, and rotation about the coordinate axes.
Camera objects are positioned and oriented in three dimensions to serve
as viewpoints. A rectangular cropping region (or Frame) on the Camera's
projection plane declares the size of the "photo" for use with a
Projector, as mentioned below.
Each application should contain a single "screen" object (whose class is
a descendant of Screen) which is appropriate for the hardware
configuration (although it may be possible to allow multiple screen
objects, for situations where multiple monitors are available).
Presently there exist Mac_Screen and PC_Screen classes, although it is
hoped that more will become available in the future. The application
may contain several Projector objects, each of which is associated with
a rectangular window (or Frame) on the Screen. The application may also
contain several Camera objects and Segments. Segments are drawn by
specifying which Camera and which Projector to use. Segments may be
drawn repeatedly in a loop to obtain animation.
A class called Generic_Pict serves as a generic Picture application,
which defines Screen, Error, and Backdrop_Projector (black backdrop)
objects. The easiest way to create a new Picture application is to
define a new class which inherits these properties from Generic_Pict and
overrides the init(), run(), and destroy() methods (calling the
inherited ones as well) to draw specialized figures. These specialized
figures should be defined elsewhere as subclasses of Segment. Note that
the Error object automatically reports errors to the file error.fil.
Examine this file after running the application to aid debugging. Three
example applications are included.
FILES:
picthelp this file
(The following files comprise the Picture library. Please read the
comments in the source and header files of any classes you will
override, especially Generic_Pict.)
class.h defines Generic_Class, from which all classes derive.
Also includes declarations for Think C/C++ compatibility
class.c methods for Generic_Class
error.h defines Error class, for reporting certain errors to
error.fil
error.c Error methods
screen.h defines Screen and machine-specific Mac_Screen and
PC_Screen, which encapsulate all machine-specific code.
screen.c methods for Screen and descendants
color.h defines mapping of color values, for color or B&W
displays
camera.h defines Camera class representing the viewpoint for 3D
perspective projection
camera.c Camera methods
project.h defines Projector class representing the mapping from
the Camera's projection plane to a screen window
project.c Projector methods
backdrop.h defines Backdrop_Projector, which simply fills the
entire screen with a single color to hide the operating
system desktop
backdrop.c Backdrop_Projector methods
coord.h defines Coord2 and Coord3 classes for 2D and 3D
coordinates
coord.c defines operations on Coord2 and Coord3 objects
trans.h defines Transformation class and descendants:
Translation, Scaling, Rotation_X, Rotation_Y, and
Rotation_Z. Also a composite transformation for 3D
perspective transformation.
trans.c methods for these transformation classes
frame.h defines the Frame class, for 2D mappings
frame.c methods for Frame
segment.h defines Segment and Nested_Segment for defining figures
segment.c Segment methods
line.h defines Line class, a simple Segment descendant
line.c Line methods
cube.h defines Cube, a descendant of Nested_Segment consisting
of several Lines. Also defines Fast_Cube, a descendant
of Segment which draws faster
cube.c Cube methods
ring.h defines Ring, a Nested_Segment descendant for ring-
shaped collections of Cubes
ring.c Ring methods
animate.h defines Animated_Segment class, a Nested_Segment
descendant for defining animations of nested segments
animate.c Animated_Segment methods
atring.h defines Atomic_Ring, an Animated_Segment descendant very
similar to Ring
atring.c Atomic_Ring methods
anring.h defines Animated_Ring, an Animated_Segment whose nested
segments may also be animated
anring.c Animated_Ring methods
pict.h defines Generic_Pict, a generic class from which the
main application class should be derived.
pict.c Generic_Pict methods
(The following files are used to demonstrate how to use the Picture
library. Simple_Pict, Ring_Pict, and An_Ring_Pict are sample animated
pictures derived from Generic_Pict. Comments in these files indicate
how to compile the applications.)
simpict.h defines Simple_Pict, a sample 2D picture
simpict.c Simple_Pict methods plus main() function
ringpict.h defines Ring_Pict, a sample 3D picture
ringpict.c Ring_Pict methods plus main() function
anringpi.h defines An_Ring_Pict, a sample animated 3D picture
anringpi.c An_Ring_Pict methods plus main() function
REFERENCES:
Hearn & Baker, "Computer Graphics", Prentice-Hall, 1986